package game.VO
{
	import flash.utils.ByteArray;
	import game.VO.TileTemplateVO;
	
	/**
	 * ...
	 * @author Kirill Pletnev
	 */
	public class TileTemplateVO
	{
		public var id:int;
		public var walkable:Boolean;
		public var textureURL:String;
		
		public function TileTemplateVO()
		{
		}
		
		public function clone():TileTemplateVO
		{
			var vo:TileTemplateVO = new TileTemplateVO();
			
			vo.id = this.id;
			vo.walkable = this.walkable;
			vo.textureURL = this.textureURL
			
			return vo;
		}
		
		// SERIALIZATION ========================================================================
		public function serialize(data:ByteArray):void
		{
			data.writeInt(id);
			data.writeBoolean(walkable);
			data.writeUTF(textureURL);
		}
		
		public static function deserialize(data:ByteArray):TileTemplateVO
		{
			var vo:TileTemplateVO = new TileTemplateVO();
			
			vo.id = data.readInt();
			vo.walkable = data.readBoolean();
			vo.textureURL = data.readUTF();
			
			return vo;
		}
		
		public function toString():String
		{
			return "[TileTemplateVO id=" + id + " walkable=" + walkable + " textureURL=" + textureURL + "]";
		}
	}
}